<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>BackBone</title>
        <script type="text/javascript" src="js/main/underscore.js"></script>
        <script type="text/javascript" src="js/main/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="js/main/backbone.js"></script>
        <script>
            var AppRouter = Backbone.Router.extend({
                routes: {
                    "posts/:id": "getPost",
                    "*actions": "defaultRoute" // Backbone will try match the route above first
                }
            });
            // Instantiate the router
            var app_router = new AppRouter;
            app_router.on('route:getPost', function(id) {
                // Note the variable in the route definition being passed in here
                alert("Get post number " + id);
            });
            app_router.on('route:defaultRoute', function(actions) {
                alert(actions);
            });
            // Start Backbone history a necessary step for bookmarkable URL's
            Backbone.history.start();

        </script>
    </head>
    <body>
    </body>
</html>
